home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17555 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  47 lines

  1. Newsgroups: comp.lang.c++
  2. Path: dmocc2.on.bell.ca!bc2cep!news
  3. From: Eric Marc Loebenberg <loebenbe@qc.bell.ca>
  4. Subject: Re: readfile question
  5. X-Nntp-Posting-Host: cmocft.qc.bell.ca
  6. Content-Type: text/plain; charset=iso-8859-1
  7. Message-ID: <3173A76B.A1A@qc.bell.ca>
  8. Sender: news@on.bell.ca (news admin)
  9. Content-Transfer-Encoding: 8bit
  10. Cc: cs805-06@mcs.csuhayward.edu
  11. Organization: Bell Sygma
  12. References: <cs805-06-1404962104230001@10.0.2.15>
  13. Mime-Version: 1.0
  14. Date: Tue, 16 Apr 1996 13:58:03 GMT
  15. X-Mailer: Mozilla 2.0 (Win95; I)
  16.  
  17. Steve wrote:
  18. > Hi, I would like to know if there is a c++ function that will read
  19. > characters from a string untill it reaches a space.  I saw that there is a
  20. > function that reads until it gets to a newline, but cant find anything
  21. > that reads until it gets to a spaceSteve,
  22.  
  23. Normally you would read either a fixed chunk of data or a line (i.e.
  24. up to first \n) into a buffer and then use buffer manipulation (string)
  25. manipulation routines to either tokenize or manipulate your data.  For
  26. example, you could use CString::Find tolocate your space.  
  27.  
  28. You can also use the standard C library to achieve what you want:
  29.  
  30. #include <stdio.h>
  31. int fscanf( FILE *stream, const char *format [, argument ]... );
  32.  
  33. allows you to read from the file up to a blank.
  34.  
  35. You probably would prefer to use a C++ technique...
  36.  
  37. I hope that helps.
  38.   
  39. ***************************************************************
  40.   Eric Marc Loebenberg                  loebenbe@qc.bell.ca
  41.   Bell Sygma Inc.                   or: loebenbe@post.sygma.net
  42.   700 de la GauchetiΦre West       Tel: 514-870-0465
  43.   Room 14W1                        Fax: 514-870-7583
  44.   Montreal, Quebec, Canada
  45.   H3B 4L1
  46.